<!doctype html>
<html lang="en">
<head>
    @include('web.layout.head')
    <link rel="stylesheet" href="{{asset('/css/web/user/member_edit.css')}}">
</head>
<body>
@include('web.layout.header')
@include('web.layout.user_tab')
<div class="base_member_content">
    <div class="w1200">
        @include('web.layout.seller_nav')
        <div class="nav_right flr">
            <div class="base_content">
                <form method="post"  id="putForm" >
                    @if(isset($type) && $type == 'put')
                        {{method_field("PUT")}}
                    @endif
                    {{ csrf_field() }}

                    <div class="line_title">编辑员工</div>
                    <div class="marryreal">
                        <h4 class="name"><span class="block"></span>&nbsp;&nbsp;&nbsp;基本信息</h4>
                        <div class="content" style="min-height: auto">
                            <div class="hang top">
                                <div class="name"><span class="red">*</span>联系人：</div>
                                <div class="nameright">
                                    <input type="text" name="employee[user_nick]" class="lxrxm convention-name" placeholder="请输入联系人姓名" value="{{$ret['user_nick']}}" />
                                </div>
                            </div>
                            <div class="hang top">
                                <div class="noxname">性&nbsp;别：</div>
                                <div class="nameright gender">
                                    <label>
                                        <input name="employee[sex]" type="radio" value="0" @if(array_get($ret,'sex')==0) checked @endif class="radios" /><span class="sex" >男</span>
                                    </label>
                                    <label style="margin-left: 10px;">
                                        <input name="employee[sex]" type="radio" value="1" @if(array_get($ret,'sex')==1) checked @endif class="radios" /><span class="sex" >女</span>
                                    </label>
                                </div>
                            </div>
                            <div class="hang top">
                                <div class="noxname">职&nbsp;位：</div>
                                <div class="nameright">
                                    <input type="text" name="employee[position]" class="lxrxm job" placeholder="请输入联系人职位" value="{{array_get($ret,'position')}}">
                                </div>
                            </div>
                            <div class="hang top">
                                <div class="name"><span class="red">*</span>手&nbsp;&nbsp;机：</div>
                                <div class="nameright">
                                    <input type="text" id="lxrnum" name="employee[user_phone]" class="lxrxm" placeholder="请输入联系人手机号码" style="margin-left: -3px;" value="{{$ret['user_phone']}}" />
                                </div>
                            </div>
                            <div class="hang top">
                                <div class="noxname">座&nbsp;机：</div>
                                <div class="nameright">
                                    <input type="text" name="employee[land_area_code]" class="lxrqh landlinenumber" value="{{array_get($ret,'land_area_code')}}" placeholder="区号">
                                    <input type="text" name="employee[land_number]" class="lxrnum landlinenum" value="{{array_get($ret,'land_number')}}" placeholder="号码">
                                </div>
                            </div>
                            <div class="hang top">
                                <div class="noxname">传&nbsp;真：</div>
                                <div class="nameright">
                                    <input type="text" name="employee[fax_area_code]" class="lxrqh faxnumber" value="{{array_get($ret,'fax_area_code')}}" placeholder="区号" />
                                    <input type="text" name="employee[fax_number]" class="lxrnum faxnum" value="{{array_get($ret,'fax_number')}}" placeholder="号码" />
                                </div>
                            </div>
                            <div class="hang top" style="overflow: visible;">
                                <div class="noxname"><span class="red"></span>联系地址：</div>
                                <div class="nameright">
                                    <div class="namedtlxdz">
                                        <input type="hidden" name="employee[area_code]" value="{{array_get($ret,'area_code')}}" />
                                        <input type="hidden" name="employee[province_code]" value="{{array_get($ret,'province_code')}}" />
                                        <input type="hidden" name="employee[city_code]" value="{{array_get($ret,'city_code')}}" />

                                        @include('web.layout.city')
                                        <input type="text" name="employee[address_detail]" value="{{array_get($ret,'address_detail')}}" placeholder="请如实填写详细地址" class="address">
                                        <input type="hidden" name="employee[address]" />
                                    </div>
                                </div>
                            </div>
                            <div class="clear"></div>
                            <div class="hang top">
                                <div class="noxname">邮编：</div>
                                <div class="nameright">
                                    <input type="text" name="employee[post_code]" class="lxrnum" id="youbian" value="{{array_get($ret,'post_code')}}" placeholder="请输入邮政编码">
                                    {{--<img src="" id="shangchuantp">--}}
                                </div>
                            </div>
                        </div>
                        <h4 class="name"><span class="block"></span>&nbsp;&nbsp;&nbsp;店铺权限</h4>
                        <div class="power" style="min-height: auto">
                            @foreach($auth as $k=>$v)
                            <div class="admin">
                                @if($v['pid']!=0)
                                    <span>
                                        <input type="checkbox" class="input_check allcheck" id="check{{$v['id']}}" @if(array_key_exists($v['id'],$ret['auth'])) checked @endif name="menu[]" value="{{$v['id']}}">
                                        <label for="check{{$v['id']}}"></label>{{$v['name']}}（管理权限）
                                    </span>
                                    {{--<input type="hidden" class="input_check pidcheck" id="check{{$v['id']}}" name="menu" value="{{$v['id']}}">--}}
                                @endif
                                @if(count($v['shop_right_operation'])>0)
                                    @foreach($v['shop_right_operation'] as $key =>$val)
                                        <span>
                                            <input type="checkbox" class="input_check listcheck" id="check_menu{{$val['id']}}" @if(in_array($val['id'],$hasAction)) checked @endif  name="operation[]" value="{{$val['id']}}">
                                            <label for="check_menu{{$val['id']}}"></label>{{$val['name']}}
                                        </span>
                                    @endforeach
                                @endif
                            </div>
                            @endforeach
                             {{--<div class="admin">--}}
                                {{--<span>--}}
                                    {{--<input type="checkbox"class="input_check allcheck" id="check3" value="3">--}}
                                    {{--<label for="check3"></label>商品管理（操作权限）--}}
                                {{--</span>--}}
                                {{--<span>--}}
                                    {{--<input type="checkbox"class="input_check listcheck" id="check4" value="4">--}}
                                    {{--<label for="check4"></label>商品发布--}}
                                {{--</span>--}}
                                {{--<span>--}}
                                    {{--<input type="checkbox"class="input_check listcheck" id="check5" value="5">--}}
                                    {{--<label for="check5"></label>商品上架--}}
                                {{--</span>--}}
                            {{--</div>--}}
                            {{--<div class="admin">--}}
                                {{--<span>--}}
                                    {{--<input type="checkbox"class="input_check allcheck" id="check6" value="6">--}}
                                    {{--<label for="check6"></label>订单管理（操作权限）--}}
                                {{--</span>--}}
                                {{--<span>--}}
                                    {{--<input type="checkbox"class="input_check listcheck" id="check7" value="7">--}}
                                    {{--<label for="check7"></label>关闭订单--}}
                                {{--</span>--}}
                                {{--<span>--}}
                                    {{--<input type="checkbox"class="input_check listcheck" id="check8" value="8">--}}
                                    {{--<label for="check8"></label>修改价格--}}
                                {{--</span>--}}
                                {{--<span>--}}
                                    {{--<input type="checkbox"class="input_check listcheck" id="check9" value="9">--}}
                                    {{--<label for="check9"></label>订单发货--}}
                                {{--</span>--}}
                                {{--<span>--}}
                                    {{--<input type="checkbox"class="input_check listcheck" id="check10" value="10">--}}
                                    {{--<label for="check10"></label>订单评价--}}
                                {{--</span>--}}
                            {{--</div>--}}
                            {{--<div class="admin">--}}
                                {{--<span>--}}
                                    {{--<input type="checkbox"class="input_check allcheck" id="check11" value="11">--}}
                                    {{--<label for="check11"></label>商铺管理（管理权限）--}}
                                {{--</span>--}}
                                {{--<span>--}}
                                    {{--<input type="checkbox"class="input_check listcheck" id="check12" value="12">--}}
                                    {{--<label for="check12"></label>店铺装修--}}
                                {{--</span>--}}
                                {{--<span>--}}
                                    {{--<input type="checkbox"class="input_check listcheck" id="check13" value="13">--}}
                                    {{--<label for="check13"></label>店铺图片--}}
                                {{--</span>--}}
                                {{--<span>--}}
                                    {{--<input type="checkbox"class="input_check listcheck" id="check14" value="14">--}}
                                    {{--<label for="check14"></label>品牌管理--}}
                                {{--</span>--}}
                                {{--<span>--}}
                                    {{--<input type="checkbox"class="input_check listcheck" id="check15" value="15">--}}
                                    {{--<label for="check15"></label>店铺配置--}}
                                {{--</span>--}}
                            {{--</div>--}}
                            {{--<div class="admin">--}}
                                {{--<span>--}}
                                    {{--<input type="checkbox"class="input_check allcheck" id="check16" value="16">--}}
                                    {{--<label for="check16"></label>其他管理（管理权限）--}}
                                {{--</span>--}}
                                {{--<span class="back">--}}
                                    {{--<input type="checkbox"class="input_check listcheck" id="check17" value="17">--}}
                                    {{--<label for="check17"></label>退换货&nbsp;--}}
                                {{--</span>--}}
                                {{--<span>--}}
                                    {{--<input type="checkbox"class="input_check listcheck" id="check18" value="18">--}}
                                    {{--<label for="check18"></label>合同管理--}}
                                {{--</span>--}}
                            {{--</div>--}}
                        </div>
                    </div>
                    <div class="anniu">
                        <a href="{{asset('/member/seller/member')}}" class="return">返回</a>
                        <input type="button" class="tijiao" value="保存" style="height: 32px;width: 100px;font-size: 12px;color:#fcfcfc;background: #028eef;line-height: 32px;border:0;margin-left: -307px;" />
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
@include('web.layout.footer')
</body>
<script>
    $(function() {
        $(".listcheck").click(function(){
            $(this).parent().siblings().find('.allcheck').prop('checked',true);
            $(this).parent().siblings().find('.pidcheck').prop('checked',true);

        });
        $(".allcheck").click(function(){
            if ($(this) .prop("checked")) {
                $(this).parent().nextAll().find('.listcheck').prop('checked',true);
                $(this).parent().nextAll().find('.pidcheck').prop('checked',true);

            }else{
                $(this).parent().nextAll().find('.listcheck').prop('checked',false);
            }
        });
       //----------------------------当点击提交按钮是的判断
        $(".tijiao").click(function() {
            var $this = $('#putForm');

            $('input[name="employee[province_code]"]').val($this.find(".form-group .select-item:eq(0)").data('code'));
            $('input[name="employee[city_code]"]').val($this.find(".form-group .select-item:eq(1)").data('code'));
            $('input[name="employee[area_code]"]').val($this.find(".form-group .select-item:eq(2)").data('code'));

            $.ajax({
               url : '{{Request::url()}}',
               type : 'put',
               dataType : "json",
               data : $("#putForm").serialize(),
               success : function(data) {
            //                alert(data)
                   if (0 == data.code) {
                       layer.alert("修改成功", {
                           icon: 1
                       }, function () {
                            location.href = '/member/seller/member';
                       });
                   } else {
                       layer.alert(data.message, {
                           icon: 2
                       });
                   }
               }
            });
        });

        if ('{{array_get($ret,"area_code") > 0}}') {
            var province_code = '{{array_get($ret,"province_code")}}';
            var province_name = '{{array_get($ret,"province_name")}}';
            var city_code = '{{array_get($ret,"city_code")}}';
            var city_name = '{{array_get($ret,"city_name")}}';
            var area_code = '{{array_get($ret,"area_code")}}';
            var area_name = '{{array_get($ret,"area_name")}}';
            var address_con = '<span class="select-item" data-count="province" data-code="' + province_code + '">' + province_name + '</span>/<span class="select-item" data-count="city" data-code="' + city_code + '">' + city_name + '</span>/<span class="select-item" data-count="district" data-code="' + area_code + '">' + area_name + '</span>';
            $('.city-picker-span .placeholder').hide().next('.title').html(address_con).show();
        }
    })

</script>
</html>